﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using System.Text;

using LINQToolKit;
using LINQToolKit.Douban.Entities;
using LINQToolKit.Mapping;
using LINQToolKit.Processors;

namespace  LINQToolKit.Douban.Processors
{
    public sealed class LinksProcessor : PropertyProcessor
    {
        public override object FromXml(MetaProperty meta, IEnumerable<XElement> elements)
        {
            return 
                (from e in elements
                select new Link
                {
                    Ref = e.Attribute("rel").GetString(),
                    Href = e.Attribute("href").GetString()
                }).ToList();
        }
    }
}
